<!DOCTYPE html>
<html>
<head>
<title>添加站点</title>
#include("../include/common.html")
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>添加站点</h5>
            </div>
           <form id="inputForm" action="save" method="post">
	            <div class="ibox-content">
	                <div class="form-horizontal clearfix">
	                    <div class="form-group">
	                        <label class="col-sm-3 control-label">名称：</label>
	                        <div class="col-sm-3">
	                            <input placeholder="名称" class="form-control" type="text" name="name">
	                        </div>
	                    </div>
	                    <div class="form-group">
	                        <label class="col-sm-3 control-label">域名：</label>
	                        <div class="col-sm-3">
	                            <input placeholder="域名" class="form-control" type="text" name="domain">
	                        </div>
	                    </div>
	                    <div class="form-group">
                            <label class="col-sm-3 control-label">类型：</label>
                            <div class="col-sm-3">
                                <div class="radio" id="type">
                                    <label class="m-r"><input name="type" value="1" type="radio">新站点</label>
                                    <label class="m-r"><input name="type" value="2" type="radio">数据同其他站点</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-horizontal clearfix" id="type1" style="display: none">
                            <div class="form-group">
	                            <label class="col-sm-3 control-label">网站名称：</label>
	                            <div class="col-sm-3">
	                                <input class="form-control" type="text" name="siteName" value="JreCms">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站网址：</label>
	                            <div class="col-sm-3">
	                                <input class="form-control" type="text" name="siteUrl" value="http://www.jrecms.com">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站logo：</label>
	                            <div class="col-sm-3">
	                                <input type="text" class="form-control" name="logo" value="/upload/image/logo.png"/>
	                            </div>
	                            <div class="col-sm-3">
	                                <a href="javascript:;" class="btn btn-primary filePicker">选择文件</a>
	                                <a href="#(logo)" target="_blank">查看</a>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站标题：</label>
	                            <div class="col-sm-3">
	                                <input class="form-control" type="text" name="title" value="JreCms,JavaCms,Java内容管理系统,网站建设,网站开发,微信公众号开发,微信小程序开发,微信APP开发,webapp开发">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站关键词：</label>
	                            <div class="col-sm-3">
	                                <input class="form-control" type="text" name="keywords" value="JreCms,JavaCms,Java内容管理系统,互联网建站平台,网站建设,网站开发,微信公众号开发,微信小程序开发,微信APP开发,webapp开发">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站描述：</label>
	                            <div class="col-sm-3">
	                                <textarea class="form-control" style="height: 100px;" name="description">JreCms,JavaCms,Java内容管理系统,互联网建站平台,网站建设,网站开发,微信公众号开发,微信小程序开发,微信APP开发,webapp开发,省时省力省心,标准化制作流程,让您建站无忧</textarea>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">网站主题：</label>
	                            <div class="col-sm-3">
	                                <select class="form-control" name="theme" id="theme">
	                                    <option value="">--请选择--</option>   
	                                    #for(template : templates)
	                                        <option value="#(template)">#(template)</option> 
	                                    #end
	                                </select>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">自定义类型：</label>
	                            <div class="col-sm-3">
	                                <textarea class="form-control" style="height: 100px;" name="selfType" id="selfType"></textarea>
	                                <script type="text/javascript">$("#selfType").val("1|正常\r\n2|头条\r\n3|推荐\r\n0|未审核")</script>
	                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>(0=未审核,1=正常,不可用于其他) 格式为 数字|名称</span>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">是否开启水印：</label>
	                            <div class="col-sm-3">
	                                <div class="radio">
	                                    <label class="m-r"><input name="isWatermarkEnabled" value="true" type="radio">是</label>
	                                    <label class="m-r"><input name="isWatermarkEnabled" value="false" type="radio" checked="checked">否</label>
	                                </div>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">水印图片：</label>
	                            <div class="col-sm-3">
	                                <input class="form-control" type="text" name="watermarkImage" value="/resources/watermark.png">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-3 control-label">水印位置：</label>
	                            <div class="col-sm-3">
	                                <select class="form-control" name="watermarkPosition">
	                                    <option value="no">无</option>
	                                    <option value="topLeft">左上</option>
	                                    <option value="topRight">右上</option>
	                                    <option value="center">居中</option>
	                                    <option value="bottomLeft">左下</option>
	                                    <option value="bottomRight">右下</option>
	                                </select>
	                            </div>
	                        </div>
                        </div>
                        <div class="form-horizontal clearfix" id="type2" style="display: none">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">数据同其他站点：</label>
                                <div class="col-sm-3">
                                    <div class="radio">
                                        #for(site : sites)
                                        <label class="m-r"><input name="sameSiteId" value="#(site.id)" type="radio">#(site.name)</label>
                                        #end
                                    </div>
                                </div>
                            </div>
                        </div>
	                </div>
	            </div>
	            <div class="modal-footer col-sm-3 col-sm-offset-2">
	                <button type="submit" class="btn btn-w-m btn-primary">确定</button>
	                <button type="button" class="btn btn-w-m btn-default" onclick="history.back(); return false;">取消</button>
	            </div>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
$().ready(function() {

	var $inputForm = $("#inputForm");
	var $type = $("#type");
	var $sameSiteId = $("input[name='sameSiteId']");
	var $theme = $("#theme");
	
	
	$type.on("click","input[type='radio']",function(){
		$("#type1").hide();
        $("#type2").hide();
        if("1"==$(this).val()){
            $sameSiteId.rules("remove");
            $theme.rules("add",{required:true});
        }else if("2"==$(this).val()){
            $sameSiteId.rules("add",{required:true});
            $theme.rules("remove");
        }
	    $("#type"+$(this).val()).show();
    });
	
	// 表单验证
	$inputForm.validate({
		rules: {
			name: "required",
			type: "required"
		}
	});

});
</script>
